package com.zhouyibike.uu.ui.activity.mybike;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.zhouyibike.uu.R;
import com.zhouyibike.uu.ui.base.BaseActivity;

public class FirstZhuanzengActivity extends BaseActivity implements View.OnClickListener {
    private ImageButton mBtnBack;
    private TextView mBtnTitle;
    private TextView gozhuanrang,jiaochengprice;
    private Button btn_succ;
    private int totalnum;
    private double zhuanzengprice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_firstzhuanzeng);
        totalnum = getIntent().getIntExtra("cansellnum", 0);
        zhuanzengprice = getIntent().getDoubleExtra("zhuanzengprice", 0);
        initView();
        setResult(1);
    }

    private void initView() {
        jiaochengprice= (TextView) findViewById(R.id.jiaochengprice);
        mBtnBack = (ImageButton) findViewById(R.id.bar_btn_back);
        mBtnTitle = (TextView) findViewById(R.id.bar_text_title);
        mBtnTitle.setText("好友转赠教程");
        gozhuanrang = (TextView) findViewById(R.id.gozhuanrang);
        mBtnBack.setOnClickListener(this);
        gozhuanrang.setOnClickListener(this);
        jiaochengprice.setText(zhuanzengprice+"");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bar_btn_back:
                finish();
                break;
            case R.id.gozhuanrang:
                Intent intent3 = new Intent(this, HaoyouZhuanzengActivity.class);
                intent3.putExtra("cansellnum", totalnum);
                intent3.putExtra("zhuanzengprice", zhuanzengprice);
                startActivityForResult(intent3, 302);
                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 302 && resultCode == 101) {
            setResult(1);
            finish();
        }
    }
}
